package com.example.demo.queue.blockingQueue;

/**
 * @desc:
 * @author: fuxiang
 * @date: 2018/8/30 16:46
 */
public class Producer implements Runnable {

    private String instance;


    public Producer(String instance) {
        this.instance = instance;
    }

    @Override
    public void run() {
      while (true){
          // 生产苹果
          try {
              System.out.println("生产者准备生产苹果：" + instance);
              Basket.put();
              System.out.println("!生产者生产苹果完毕：" + instance);
              // 休眠300ms
              Thread.sleep(2000);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
      }
    }
}
